21.03.2011, 10:48
Well, first of all.
Thanks for who'll help me, or just who will try to =].
Alright, I'm trying to add something to my mod, so when player will /pickupgun the Anti Cheat won't kick him.
Tried to add the whole 'FS' to the Mod, so I can do : SafeGivePlayerWeapon.
Because in the FS it won't reconize this function.
So I've added it :
I wish I could do something, but I've tried few times.
Thanks
!
Thanks for who'll help me, or just who will try to =].
Alright, I'm trying to add something to my mod, so when player will /pickupgun the Anti Cheat won't kick him.
Tried to add the whole 'FS' to the Mod, so I can do : SafeGivePlayerWeapon.
Because in the FS it won't reconize this function.
So I've added it :
PHP Code:
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/dropgun", true) == 0 || strcmp(cmd, "/dgun", true) == 0)
{
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(ObjCoords); a++)
{
if(ObjCoords[a][0] == 0.0)
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You can not throw weapons at the moment, try back later!!");
new gunname[25];
new buffer[100];
GetWeaponNameEx(gunID, gunname, sizeof(gunname));
format(buffer, sizeof(buffer), "You threw %s", gunname);
SendClientMessage(playerid, 0x33AA3300, buffer);
RemovePlayerWeapon(playerid, gunID);
ObjectID[f][0] = gunID;
ObjectID[f][1] = gunAmmo;
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateObject(GunObjects[gunID][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0);
return 1;
}
}
if(strcmp(cmd, "/pickupgun", true) == 0 || strcmp(cmd, "/pgun", true) == 0)
{
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(ObjCoords); a++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, ObjCoords[a][0], ObjCoords[a][1], ObjCoords[a][2]))
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You are not near the weapon which you can pick up!");
else
{
new gunname[25];
new buffer[100];
ObjCoords[f][0] = 0.0;
ObjCoords[f][1] = 0.0;
ObjCoords[f][2] = 0.0;
DestroyObject(object[f]);
SafeGivePlayerWeapon(playerid, ObjectID[f][0], ObjectID[f][1]);
GetWeaponNameEx(ObjectID[f][0], gunname, sizeof(gunname));
format(buffer, sizeof(buffer), "You picked up %s", gunname);
SendClientMessage(playerid, 0x33AA3300, buffer);
}
return 1;
}
return 0;
}
Thanks
![Cheesy](images/smilies/biggrin.png)