error at /givemoney
#1

hey i get 11 errors :
Код:
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : error 001: expected token: "-identifier-", but found "new"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(137) : error 017: undefined symbol "idx"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(138) : error 017: undefined symbol "tmp2"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(138) : error 017: undefined symbol "idx"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(146) : warning 217: loose indentation
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(146) : error 017: undefined symbol "tmp2"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(151) : warning 217: loose indentation
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(153) : error 017: undefined symbol "tmp2"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(155) : error 036: empty statement
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(156) : error 001: expected token: ",", but found "-string-"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(156) : warning 215: expression has no effect
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(156) : error 001: expected token: ";", but found ")"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(156) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


11 Errors.


anyone please help me here is the script please help me
http://pastebin.com/WnuEAJ7e
Reply
#2

this line : new tmp[256], new tmp2[256];
change to : new tmp[256], tmp2[256],idx;
Reply
#3

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#pragma tabsize 0

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Test by yvoms");
    print("----------------------------------\n");
}

// colors

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF
#endif

public OnGameModeInit()
{
    // Gamemode naam
    SetGameModeText("Gamemode test");
    // Classes
    AddPlayerClass(0,1962.0569,1342.8542,15.4823,87.7441,25,100,0,0,0,0); // GuySpawn
    AddPlayerClass(2,2093.7515,1233.9307,10.8203,88.0575,28,300,0,0,0,0); // GuySpawn2
    // Cars
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2205.5649,1275.5612,10.8203);
    SetPlayerFacingAngle(playerid,2.3717);
    SetPlayerCameraPos(playerid, 2206.0969,1283.4077,10.8203);
    SetPlayerCameraLookAt(playerid, 2205.5649,1275.5612,10.8203);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if(!strcmp(cmdtext, "/YourCommand", true))
    {
    SetPlayerHealth (playerid, 100);
    SendClientMessage (playerid, COLOR_ORANGE , "You have been Healed");
    return 1;
    }
   
        if(!strcmp(cmdtext, "/YourCommand", true))
    {
    SetPlayerHealth (playerid, 0);
    SendClientMessage (playerid, COLOR_ORANGE , "You have commited Suicide");
    return 1;
    }
   
    if(!strcmp(cmdtext, "/YourCommand", true))
    {
        SendClientMessage (playerid, COLOR_YELLOW , "Welcome to this server we hope You enjoy!");
        SendClientMessage (playerid, COLOR_YELLOW , "We are currently being scripted by Yvoms");
        SendClientMessage (playerid, COLOR_YELLOW , "Type /Heal to heal urself!");
        SendClientMessage (playerid, COLOR_YELLOW , "type /kill to commit suicide!");
        return 1;
    }

    if(!strcmp(cmdtext, "/YourCommand", true))
    new tmp[256], tmp2[256],idx;
    tmp = strtok (cmdtext, idx);
    tmp2 = strtok (cmdtext, idx);


    if (!strlen (tmp) ) {
         SendClientMessage (playerid, COLOR_ORANGE, "Usage: /givemoney [playerid] [amount]");
         return 1;
    }

        if (!strlen (tmp2) ) {
         SendClientMessage (playerid, COLOR_ORANGE, "Usage: /givemoney [playerid] [amount]");
         return 1;
    }

    new receiver, money;
    receiver = strval(tmp);
    money = strval(tmp2);

    if (GetPlayerMoney (playerid) < money); {
    SendClientMessage(playerid, COLOR_ORANGE "The amount of money you typed in is higher than the amount of cash you have");
    return 1;
    }

    new string[126];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(receiver, playername2, sizeof(playername2));

    format(string, sizeof(string) "you receive $%d from %s.", money, playername);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string) "you give $%d to %s.", money, playername2);
    SendClientMessage(playerid, COLOR_ORANGE, string);

    GivePlayerMoney(playerid, (0 - money));
    GivePlayerMoney(receiver, money);
    return 1;
    }
   
   
    return 0;
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Try that pm me if that doesnt work
Reply
#4

pawn Код:
if(!strcmp(cmdtext, "/YourCommand", true)){ //add a "{" here
    new tmp[256], tmp2[256],idx;
    tmp = strtok (cmdtext, idx);
    tmp2 = strtok (cmdtext, idx);
like that
Reply
#5

i still get 4 errors
Код:
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : error 003: declaration of a local variable must appear in a compound block
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : error 017: undefined symbol "tmp"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : warning 215: expression has no effect
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : error 001: expected token: ";", but found "]"
C:\Users\familia\Desktop\samp03bsvr_R2_win32\gamemodes\test.pwn(136) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

someone told me i fotgot to put these infront of the "new" line's
can someone please help me i just started scripting yesterday and idk sh1t anymore xD
Reply
#7

All i can tell you is that it is something wrong at line 136 xD
Reply
#8

try the samp wiki there is a tutorial on how to do it
Reply
#9

Use ZCMD and SSCANF, it's way much faster and it doesn't need strtok, and all that tmp, idx, strtok bullshizzles.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)