Hallo liebe Community,
Ich habe ein Problem mit dem Befehl /grab ....Also das mit in ein Auto gezogen wird ...!
Da kommen immer diese Errors :
C:\Users\MSI\Desktop\server\filterscripts\base.pwn(36) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\MSI\Desktop\server\filterscripts\base.pwn(157) : error 017: undefined symbol "giveplayer"
C:\Users\MSI\Desktop\server\filterscripts\base.pwn(157) : error 017: undefined symbol "giveplayer"
C:\Users\MSI\Desktop\server\filterscripts\base.pwn(157) : error 029: invalid expression, assumed zero
C:\Users\MSI\Desktop\server\filterscripts\base.pwn(157) : fatal error 107: too many error messages on one line
Joa aulso der Code ist volgender :
if(strcmp(cmd, "/grab", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xB754FFFF, "Benutze: /grab [ID]");
return 1;
}
new person;
person = strval(tmp);
if(IsPlayerConnected(person))
{
if(person != INVALID_PLAYER_ID)
{
if(GetDistanceBetweenPlayers(playerid,person) <= 8)
{
if(IsPlayerInAnyVehicle(person))
{
SendClientMessage(playerid, 0xB754FFFF, " Ziel ist in einem Auto!");
return 1;
}
if(person == playerid) { SendClientMessage(playerid, 0xB754FFFF, "Du kannst dich nicht selbst grabben!"); return 1; }
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2)
{
new playerVehicle = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(person, playerVehicle, 3);
GetPlayerName(person, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Du wurdest von %s ins Farzeug gezogen.", sendername);
SendClientMessage(person, 0xB754FFFF, string);
format(string, sizeof(string), "* Du hast %s ins Fahrzeug gezogen.", giveplayer);
SendClientMessage(playerid, 0xB754FFFF, string);
format(string, sizeof(string), "* %s hat %s ins Fahrzeug gezogen", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, 0xB754FFFF,0xB754FFFF,0xB754FFFF,0xB754FFFF,0xB754FFFF);
GameTextForPlayer(giveplayerid, "~r~Festgenommen", 2500, 3);
TogglePlayerControllable(person, 0);
PlayerCuffed[person] = 2;
PlayerCuffedTime[person] = 180;
}
else
{
SendClientMessage(playerid, 0xB754FFFF, " Du fährst kein Auto!");
return 1;
}
}
else
{
SendClientMessage(playerid, 0xB754FFFF, " Spieler ist nicht in deine Nähe!");
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/ungrab", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, 0xB754FFFF, "Benutze: /ungrab [ID]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, 0xB754FFFF, "Du kannst dich nicht selbst ungrabben!"); return 1; }
if(PlayerCuffed[giveplayerid])
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Du wurdest von %s freigelassen.", sendername);
SendClientMessage(giveplayerid, 0xB754FFFF, string);
format(string, sizeof(string), "* Du hast %s freigelassen.", giveplayer);
SendClientMessage(playerid, 0xB754FFFF, string);
format(string, sizeof(string), "* %s hat %s freigelassen.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, 0xB754FFFF,0xB754FFFF,0xB754FFFF,0xB754FFFF,0xB754FFFF);
GameTextForPlayer(giveplayerid, "~g~Freiheit", 2500, 3);
TogglePlayerControllable(giveplayerid, 1);
PlayerCuffed[giveplayerid] = 0;
RemovePlayerFromVehicle(giveplayerid);
}
else
{
SendClientMessage(playerid, 0xB754FFFF, " Person hat keine Handschellen!");
return 1;
}
}
else
{
SendClientMessage(playerid, 0xB754FFFF, " Spieler ist nicht bei dir!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, 0xB754FFFF, " Offline!");
return 1;
}
}
return 1;
}
Und:
new giveplayerid, moneys, idx;
forward Float:GetDistanceBetweenPlayers(p1,p2);
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Kann mir wer helfen bei der Error behebung oder mir einen Ganz neuen Code geben ?
Mfg,
TheGodOma