PDA

View Full Version : Adding Numbers to NPC's Name


4FunPlayin
20/11/2011, 10:56 AM
I want to number my bots so each will have a number after his name

This is my code:
http://pastebin.com/22nTcBdf

I don't know how to add numbers to a string so I tried this:
str = "Tankz" + tankz[ZST];
but I get four errors saying
C:\Users\idktwospel\Desktop\SAMP\gamemodes\GTAZFIL G.pwn(125) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\idktwospel\Desktop\SAMP\gamemodes\GTAZFIL G.pwn(125) : error 033: array must be indexed (variable "-unknown-")
C:\Users\idktwospel\Desktop\SAMP\gamemodes\GTAZFIL G.pwn(132) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\idktwospel\Desktop\SAMP\gamemodes\GTAZFIL G.pwn(132) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


lines 125 and 132 are 'str = "Tankz" + tankz'.

Please help, thanks.

Kostas'
20/11/2011, 11:06 AM
if (strcmp("/spawntanks", cmdtext, true, 10) == 0) {
new tankz[20], ZST, str[256];
for(ZST = 10; ZST > -1; ZST--) {
// tank-recreate
tankz[ZST] = CreateVehicle(432,-1891.9185,2329.9373,41.2264,21.4328,43,0, 500000);
format(str, sizeof(str), "Tankz[%d]", ZST);
ConnectNPC(str, "tan_recrea_1");
Wait(5000); // 5 seconds
}
for(ZST = 10; ZST > -1; ZST--) {
// tank-recreate-2
tankz[ZST] = CreateVehicle(432,-1882.2782,2321.6658,39.3744,21.6763,43,0, 500000);
format(str, sizeof(str), "Tankz[%d]", ZST);
ConnectNPC(str, "tan_recrea_2");
Wait(5000); // 5 seconds
}

return 1;
}