SA-MP Forums Archive
Im getting errors with a piece of code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Im getting errors with a piece of code (/showthread.php?tid=140703)



Im getting errors with a piece of code - Micko9 - 10.04.2010

pawn Код:
(111)     if (GetVehicleModel(vehicleid)==CarInfo[i][ModelID] && CarInfo[i][OwnerName]!=PlayerName(playerid)) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,0xAA000AA,"Acces Denied!");
        }
errors :

Код:
(111) : error 033: array must be indexed (variable "PlayerName")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: Im getting errors with a piece of code - dice7 - 10.04.2010

Use strcmp for comparing strings
https://sampwiki.blast.hk/wiki/Strcmp

pawn Код:
if (GetVehicleModel(vehicleid)==CarInfo[i][ModelID])
{
    if (strcmp(CarInfo[i][OwnerName], PlayerName(playerid)) != 0)
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,0xAA000AA,"Acces Denied!");
    }
}