AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help (https://forums.alliedmods.net/showthread.php?t=17789)

Austin22 09-09-2005 01:48

help
 
how do i make it if you touch someone then they automaticly die? sorry for stupid question im noob at coding

v3x 09-09-2005 07:24

Code:
public pfn_touch(ptr,ptd) {     if(ptr > 0 && ptd > 0)     {         new pToucher[32],pTouched[32];         entity_get_string(ptr,EV_SZ_classname,pToucher,31);         if(ptd > 0 && is_valid_ent(ptd))             entity_get_string(ptd,EV_SZ_classname,pTouched,31);         if(equal(pTouched,"player") && is_user_connected(ptd))             user_kill(ptd);     } }

Xanimos 09-09-2005 13:58

v3x What is your problem with double checking things.
Quote:

Originally Posted by v3x
Code:
if(ptr > 0 && ptd > 0)
Code:
if(ptd > 0 && is_valid_ent(ptd))


XxAvalanchexX 09-09-2005 15:46

This would be the proper way:

Code:
public pfn_touch(ptr,ptd) {     if(is_user_connected(ptr) && is_user_connected(ptd))     {             user_kill(ptd);     } }

Austin22 09-09-2005 16:32

thanks.


All times are GMT -4. The time now is 14:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.