if(strcmp(cmd, "/verstauen", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i=0; i < MAX_PLAYERS; i++)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsACop(i))
{
if(ProxDetectorS(20.0, playerid, i))
{
SendClientMessage(playerid, COLOR_GRAD1, "Cops sind in der Nähe, du kannst nichst verstauen!");
return 1;
}
}
}
new namen[256];
namen = strtok(cmdtext, idx);
if(!strlen(namen))
{
SendClientMessage(playerid, COLOR_GOLD, "|__________________ Befehlshilfe _________________|");
SendClientMessage(playerid, COLOR_GOLD, "Benutzung: /verstauen [Name] ([Menge])");
SendClientMessage(playerid, COLOR_GOLD, "Namen: Waffe1, Waffe2, Materialien, Drogen");
return 1;
}
if(strcmp(namen,"Waffe1", true) == 0)
{
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
PlayerInfo[playerid][pInvWeapon] = gunID;
PlayerInfo[playerid][pInvAmmo] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), " %s in die Tasche verstaut.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du hast keine Waffe, die du in die Tasche verstauen kannst!");
return 1;
}
}
if(strcmp(namen,"Waffe2", true) == 0)
{
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
PlayerInfo[playerid][pInvWeapon2] = gunID;
PlayerInfo[playerid][pInvAmmo2] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), " %s in die Tasche verstaut.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du hast keine Waffe, die du in die Tasche verstauen kannst!");
return 1;
}
}
if(strcmp(namen,"Drogen", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /verstauen Drogen [Menge]");
format(string, sizeof(string), "Du hast %d Drogen dabei.", PlayerInfo[playerid][pDrugs]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new tdrugs;
tdrugs = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /verstauen Drogen [Menge]");
format(string, sizeof(string), " Du hast %d Drogen dabei.", PlayerInfo[playerid][pDrugs]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if(tdrugs + PlayerInfo[playerid][pInvDrugs] > 60)
{
SendClientMessage(playerid, COLOR_GRAD1, "Du kannst maximal 60 Gramm Drogen in deiner Tasche verstauen!");
return 1;
}
if(tdrugs > PlayerInfo[playerid][pDrugs])
{
SendClientMessage(playerid, COLOR_GRAD2, "So viele Drogen hast du nicht dabei!");
return 1;
}
PlayerInfo[playerid][pDrugs] -= tdrugs;
PlayerInfo[playerid][pInvDrugs] += tdrugs;
format(string, sizeof(string), "%d Gramm Drogen in die Tasche verstaut.", tdrugs);
SendClientMessage(playerid, COLOR_GRAD4, string);
return 1;
}
if(strcmp(namen,"Materialien", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /verstauen Materialien [Menge]");
format(string, sizeof(string), "Du hast %d Materialien dabei", PlayerInfo[playerid][pMats]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new matss;
matss = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /verstauen Materialien [Menge]");
format(string, sizeof(string), " Du hast %d Materialien dabei.", PlayerInfo[playerid][pMats]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if(matss + PlayerInfo[playerid][pInvMats] > 4000)
{
SendClientMessage(playerid, COLOR_GRAD1, "Du kannst maximal 4000 Materials in deiner Tasche verstauen!");
return 1;
}
if(matss > PlayerInfo[playerid][pMats])
{
SendClientMessage(playerid, COLOR_GRAD2, "So viele Materialien hast du dabei!");
return 1;
}
PlayerInfo[playerid][pMats] -= matss;
PlayerInfo[playerid][pInvMats] += matss;
format(string, sizeof(string), "%d Materialien in die Tasche verstaut.", matss);
SendClientMessage(playerid, COLOR_GRAD4, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Ungültiger Name!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Du musst dich erst einloggen!");
}
return 1;
}
Bitte xD