01.03.2018, 17:47
Ok so this is my code when I do a command like "/hitman" it gives me the weapons before it too any way to stop this?
Код:
#include <core>
#include <float>
#include <string>
#include <file>
#include <time>
#include <datagram>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
#include <a_sampdb>
public OnPlayerCommandText(playerid, cmdtext[]) // if a player writes command
{ // callback starts.
//LAW
if (strcmp("/police", cmdtext, true, 10) == 0) // if a player writes /police
{ // if he writes, start these functions:
GivePlayerWeapon(playerid, 22, 10000);
GivePlayerWeapon(playerid, 3, 1);
GivePlayerWeapon(playerid, 22, 10000);
GivePlayerWeapon(playerid, 41, 10000);
}
{
if (strcmp("/swat", cmdtext, true, 10) == 0) // if a player writes /swat
GivePlayerWeapon(playerid, 31, 10000);
GivePlayerWeapon(playerid, 27, 10000);
GivePlayerWeapon(playerid, 24, 10000);
GivePlayerWeapon(playerid, 17, 10000);
}
{
if (strcmp("/ff", cmdtext, true, 10) == 0) // if a player writes /ff
GivePlayerWeapon(playerid, 42, 10000);
}
{
if (strcmp("/whore", cmdtext, true, 10) == 0) // if a player writes /whore
GivePlayerWeapon(playerid, 10, 1);
GivePlayerWeapon(playerid, 11, 1);
GivePlayerWeapon(playerid, 12, 1);
GivePlayerWeapon(playerid, 13, 1);
}
{
if (strcmp("/hitman", cmdtext, true, 10) == 0) // if a player writes /hitman
GivePlayerWeapon(playerid, 34, 10000);
}
{
if (strcmp("/terrorist", cmdtext, true, 10) == 0) // if a player writes /terrorist
GivePlayerWeapon(playerid, 35, 10000);
GivePlayerWeapon(playerid, 8, 1);
GivePlayerWeapon(playerid, 30, 10000);
}
{
if (strcmp("/maniac", cmdtext, true, 10) == 0) // if a player writes /maniac
GivePlayerWeapon(playerid, 9, 10000);
}
{
if (strcmp("/photographer", cmdtext, true, 10) == 0) // if a player writes /photographer
GivePlayerWeapon(playerid, 43, 10000);
// If he writes, Give player police weapon's
return 1; // return true.
} // we ended this command's functions.
return 0; // return false because there is a true above.
} // we ended this callback's functions.


