Please Help
#1

Please tell me why this doesnt work

PHP код:
command(setplateplayeridparams[])
{
    new 
plate[126], vehslot;
    if(
sscanf(params"ii"platevehslot))
    {
        
SendClientMessage(playeridWHITE"SYNTAX: /setplate [Plate Name] [Car Slot]");
    }
    else
    {
        switch(
vehslot)
        {
            case 
1:
            {
                
//format(string, sizeof(string), "%s", plate);
                
Player[playerid][CarPlate] = plate;
                
SetVehicleNumberPlate(Player[playerid][CarLinkID], plate);
            }
            case 
2:
            {
                
//format(string, sizeof(string), "%s", plate);
                
Player[playerid][CarPlate2] = plate;
                
SetVehicleNumberPlate(Player[playerid][Car2LinkID], plate);
            }
            case 
3:
            {
                
//format(string, sizeof(string), "%s", plate);
                
Player[playerid][CarPlate3] = plate;
                
SetVehicleNumberPlate(Player[playerid][Car3LinkID], plate);
            }
        }
    }
    return 
1;

These are my error codes:
PHP код:
error 006must be assigned to an array 
I get 3 of them.

This is what the errors are on SetVehicleNumberPlate(Player[playerid][CarLinkID], plate);
Reply
#2

A variable plate must be indexed, because it's type is an array.
Reply
#3

Quote:
Originally Posted by sabretur
Посмотреть сообщение
A variable plate must be indexed, because it's type is an array.
When you use "SetVehicleNumberPlate", what you're setting it to must be a string. With the sscanf line, you're only allowing a single integer.
Reply
#4

Quote:
Originally Posted by sabretur
Посмотреть сообщение
A variable plate must be indexed, because it's type is an array.
And how do you index it?
Reply
#5

https://sampwiki.blast.hk/wiki/SetVehicleNumberPlate
Make it string, not an integer.
Reply
#6

pawn Код:
command(setplate, playerid, params[])
{
    new plate[126], vehslot;
    if(sscanf(params, "si", plate, vehslot))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /setplate [Plate Name] [Car Slot]");
    }
    else
    {
        switch(vehslot)
        {
            case 1:
            {
                //format(string, sizeof(string), "%s", plate);
                Player[playerid][CarPlate] = plate;
                SetVehicleNumberPlate(Player[playerid][CarLinkID], plate);
            }
            case 2:
            {
                //format(string, sizeof(string), "%s", plate);
                Player[playerid][CarPlate2] = plate;
                SetVehicleNumberPlate(Player[playerid][Car2LinkID], plate);
            }
            case 3:
            {
                //format(string, sizeof(string), "%s", plate);
                Player[playerid][CarPlate3] = plate;
                SetVehicleNumberPlate(Player[playerid][Car3LinkID], plate);
            }
        }
    }
    return 1;
}
Reply
#7

pawn Код:
if(sscanf(params, "s[126]i", plate, vehslot))
You forgot the length sabretur.
Reply
#8

I tried that, and I got this error:
PHP код:
 error 035argument type mismatch (argument 2
Reply
#9

pawn Код:
format(Player[playerid][CarPlate],14,"%s",plate);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)